Use case: DMA channel direct mode transfer in polling mode ¶
Sequence diagram ¶
Code snippet ¶
|
HAL1 |
HAL2 |
|---|---|
HAL_DMA_Init(&hdma1);
HAL_DMA_Start(&hdma, (uint32_t)srcAddress, (uint32_t)dstAddress
, dataSize);
HAL_DMA_PollForTransfer(&hdma, HAL_DMA_FULL_TRANSFER, timeout);
|
HAL_DMA_Init(&hdma1, GPDMA1_CH0);
HAL_DMA_SetConfigDirectXfer(&hdma1, directXferConfig);
HAL_DMA_StartDirectXfer(&hdma, (uint32_t)srcAddress, (uint32_t)dstAddress
, dataSize * multiplier);
HAL_DMA_PollForXfer(&hdma, HAL_DMA_XFER_FULL_COMPLETE, timeout);
|
Key changes ¶
HAL2 requires explicit direct-transfer configuration using
HAL_DMA_SetConfigDirectXfer()(orHAL_DMA_SetConfigPeriphDirectXfer()).HAL2 starts transfers using
HAL_DMA_StartDirectXfer()and polls usingHAL_DMA_PollForXfer().Depending on the series, the transfer size may need to be expressed in bytes or beats (see the note in the main DMA use-cases page).

